import api from '../index'
import uploadFile from './file'
import type { ResponseData, pageParam, RequestFromType } from '../index'

// 密码短信
export const postPasswordSms = (phone : string, data ?: { areaCode : string }) =>
	api.post(`customer/api/sms/retrieve/${phone}`, {
		data,
		custom: {
			auth: false,
			showMsg: true
		}
	}
	)
// 修改支付密码
export const updatePayword = (data : {
	username : string,
	paywode : string,
	validcode : string
}) =>
	api.put('customer/api/updatePayword', {
		data,
		custom: {
			isLoading: true
		}
	})


interface editUserInfo {
	nickname ?: string,
	photo ?: string,
	userBirthday ?: string,
	userSex ?: string
}
// 修改昵称
export const editNickName = (data : editUserInfo) =>
	api.post('customer/api/edit', { data })
// 修改头像
export const editAvatar = (data : any) =>
	uploadFile(data, `customer/api/edit`)

// 修改登录密码
export const updatePassword = (data : any) =>
	api.put('customer/api/updatePassword', {
		data,
		custom: {
			isLoading: true
		}
	})